// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_pr.p_activity.p_view;

import android.view.MotionEvent;

// Referenced classes of package com.nnee.p_pr.p_activity.view:
//            cls_FlingGallery, r, ca, a, 
//            ao, bv

class cls_bi extends android.view.GestureDetector.SimpleOnGestureListener
{

    private cls_bi(cls_FlingGallery flinggallery)
    { super();
        a = flinggallery;
       
    }

    cls_bi(cls_FlingGallery flinggallery, cls_bv bv)
    {
        this(flinggallery);
    }

    private boolean a(MotionEvent motionevent, MotionEvent motionevent1)
    {
        boolean flag = true;
        float f = motionevent1.getX();
        float f1 = motionevent1.getY();
        int i = (int)Math.abs(f - cls_FlingGallery.y(a));
        int j = (int)Math.abs(f1 - cls_FlingGallery.z(a));
        boolean flag1;
        if((int)Math.abs(motionevent1.getX() - motionevent.getX()) > cls_FlingGallery.A(a))
            flag1 = flag;
        else
            flag1 = false;
        if(!flag1 || j > i)
            flag = false;
        return flag;
    }

    private boolean a(MotionEvent motionevent, MotionEvent motionevent1, float f)
    {
        boolean flag = true;
        float f1 = motionevent1.getX();
        float f2 = motionevent1.getY();
        boolean flag1;
        int i;
        int j;
        boolean flag2;
        if(f > 0F)
            flag1 = flag;
        else
            flag1 = false;
        if(cls_FlingGallery.B(a) != flag1)
        {
            cls_FlingGallery.e(a, flag1);
            cls_FlingGallery.b(a, motionevent1.getX());
            cls_FlingGallery.c(a, motionevent1.getY());
        }
        i = (int)Math.abs(f1 - cls_FlingGallery.y(a));
        j = (int)Math.abs(f2 - cls_FlingGallery.z(a));
        if((int)Math.abs(motionevent1.getX() - motionevent.getX()) > cls_FlingGallery.A(a))
            flag2 = flag;
        else
            flag2 = false;
        if(!flag2 || (double)j >= 0.5D * (double)i)
            flag = false;
        return flag;
    }

    public boolean onDoubleTap(MotionEvent motionevent)
    {
        boolean flag = false;
        if(cls_FlingGallery.G(a) != null)
            flag = cls_FlingGallery.G(a).c();
        boolean flag1;
        if(flag)
            flag1 = true;
        else
            flag1 = super.onDoubleTap(motionevent);
        return flag1;
    }

    public boolean onDown(MotionEvent motionevent)
    {
        cls_FlingGallery.b(a, false);
        cls_FlingGallery.e(a, 0);
        return false;
    }

    public boolean onFling(MotionEvent motionevent, MotionEvent motionevent1, float f, float f1)
    {
        boolean flag = false;
        if(a(motionevent, motionevent1)) goto _L2; else goto _L1
_L1:
        return flag;
_L2:
        float f2 = motionevent1.getX() - motionevent.getX();
        motionevent1.getY() - motionevent.getY();
        if(f < 0F && (int)f < -cls_FlingGallery.C(a))
        {
            if(f2 < (float)(-cls_FlingGallery.D(a)))
            {
                a.o();
                flag = true;
            }
        } else
        if(f > 0F && (int)f > cls_FlingGallery.C(a) && f2 > (float)cls_FlingGallery.D(a))
        {
            a.n();
            flag = true;
        }
        if(true) goto _L1; else goto _L3
_L3:
    }

    public void onLongPress(MotionEvent motionevent)
    {
        cls_FlingGallery.e(a, 0);
        if(cls_FlingGallery.E(a) != null)
            cls_FlingGallery.E(a).a(motionevent);
    }

    public boolean onScroll(MotionEvent motionevent, MotionEvent motionevent1, float f, float f1)
    {
        boolean flag = false;
        if(motionevent1.getAction() != 2) goto _L2; else goto _L1
_L1:
        if(!a.a(motionevent, motionevent1, f, f1)) goto _L4; else goto _L3
_L3:
        flag = true;
_L2:
        return flag;
_L4:
        if(cls_FlingGallery.s(a))
        {
            if(!a(motionevent, motionevent1, f1) && !cls_FlingGallery.t(a))
            {
                cls_FlingGallery.c(a, true);
                cls_FlingGallery.b(a, flag);
                continue; /* Loop/switch isn't completed */
            }
            cls_FlingGallery.d(a, true);
        }
        if(!cls_FlingGallery.r(a))
        {
            cls_FlingGallery.b(a, flag);
            cls_FlingGallery.c(a, true);
            cls_FlingGallery.e(a, flag);
            cls_FlingGallery.a(a, System.currentTimeMillis());
            cls_FlingGallery.a(a, cls_FlingGallery.f(a)[cls_FlingGallery.k(a)].c());
        }
        float f2 = ((float)cls_FlingGallery.u(a) / ((float)cls_FlingGallery.n(a) / 1000F)) * ((float)(System.currentTimeMillis() - cls_FlingGallery.v(a)) / 1000F);
        float f3 = motionevent.getX() - motionevent1.getX();
        int i;
        int j;
        if(f3 < f2 * -1F)
            f2 *= -1F;
        else
        if(f3 <= f2)
            f2 = f3;
        i = Math.round(f2 + cls_FlingGallery.w(a));
        if(!cls_FlingGallery.x(a))
            if(cls_FlingGallery.b(a) == a.i() && f2 > 0F)
            {
                if(i > flag)
                    i = ((flag) ? 1 : 0);
            } else
            if(cls_FlingGallery.b(a) == a.h() && f2 < 0F && i < 0)
                i = ((flag) ? 1 : 0);
        if(i >= cls_FlingGallery.u(a))
            i = cls_FlingGallery.u(a);
        else
        if(i <= -1 * cls_FlingGallery.u(a))
            i = -1 * cls_FlingGallery.u(a);
        for(j = ((flag) ? 1 : 0); j < 3; j++)
            if(f2 < 0F && j != cls_FlingGallery.a(a, cls_FlingGallery.k(a)) || f2 > 0F && j != cls_FlingGallery.b(a, cls_FlingGallery.k(a)))
                cls_FlingGallery.f(a)[j].a(i, flag, cls_FlingGallery.k(a));

        flag = true;
        if(true) goto _L2; else goto _L5
_L5:
    }

    public void onShowPress(MotionEvent motionevent)
    {
    }

    public boolean onSingleTapUp(MotionEvent motionevent)
    {
        boolean flag = false;
        cls_FlingGallery.e(a, flag);
        if(cls_FlingGallery.F(a) != null)
            flag = cls_FlingGallery.F(a).d();
        return flag;
    }

    final cls_FlingGallery a;
}
